// /////////////////////////////////////////////////////////////////////////////
//
// Name:            asAssetManager.cpp
// Author:          Michael Bartsch (ZCCdark203)
//
// Desc :           Binds the AssetManager class to AngelScript
//
// License:         Copyright (C) 2009 Michael Bartsch and Contributors
//
//                  This program is free software: you can redistribute it
//                  and/or modify it under the terms of the zlib/libpng License.
//                  See main.cpp for conditions of distribution and use.
//
// /////////////////////////////////////////////////////////////////////////////

// Include files
#include "asAssetManager.h"

#ifdef __COMPILE_WITH_ANGELSCRIPT__

#include "../../core/AssetManager.h"


//! Binds the AssetManager class to AngelScript.
void bindAssetManager(asIScriptEngine *engine)
{
    // Forward declarations.
    int r;

    // Bind AssetManager class.
    r = engine->RegisterObjectType("AssetManager", sizeof(AssetManager), asOBJ_REF); assert(r >= 0);

    // Set AssetManager behaviour.
    r = engine->RegisterObjectBehaviour("AssetManager", asBEHAVE_ADDREF, "void f()",
                                        asMETHOD(AssetManager, grab), asCALL_THISCALL); assert(r >= 0);
    r = engine->RegisterObjectBehaviour("AssetManager", asBEHAVE_RELEASE, "void f()",
                                        asMETHOD(AssetManager, drop), asCALL_THISCALL); assert(r >= 0);

    // Bind AssetManager class functions.
    r = engine->RegisterObjectMethod("AssetManager", "void init()",
                                     asMETHOD(AssetManager, init), asCALL_THISCALL); assert(r >= 0);
    r = engine->RegisterObjectMethod("AssetManager", "void clear()",
                                     asMETHOD(AssetManager, clear), asCALL_THISCALL); assert(r >= 0);

    r = engine->RegisterObjectMethod("AssetManager", "bool addAssetGroup(AssetGroup @+)",
                                     asMETHOD(AssetManager, addAssetGroup), asCALL_THISCALL); assert(r >= 0);
    r = engine->RegisterObjectMethod("AssetManager", "void createAssetGroup(const string &in, const string &in)",
                                     asMETHOD(AssetManager, createAssetGroup), asCALL_THISCALL); assert(r >= 0);
    r = engine->RegisterObjectMethod("AssetManager", "void createAssetGroup(const string &in, const string &in, bool)",
                                     asMETHOD(AssetManager, createAssetGroup), asCALL_THISCALL); assert(r >= 0);

    r = engine->RegisterObjectMethod("AssetManager", "AssetGroup@ getAssetGroup(const u32)",
                                     asMETHODPR(AssetManager, getAssetGroup, (const u32), AssetGroup*),
                                     asCALL_THISCALL); assert(r >= 0);
    r = engine->RegisterObjectMethod("AssetManager", "AssetGroup@ getAssetGroup(const string &in)",
                                     asMETHODPR(AssetManager, getAssetGroup, (const std::string&), AssetGroup*),
                                     asCALL_THISCALL); assert(r >= 0);

    r = engine->RegisterObjectMethod("AssetManager", "void removeAssetGroups()",
                                     asMETHOD(AssetManager, removeAssetGroups), asCALL_THISCALL); assert(r >= 0);
    r = engine->RegisterObjectMethod("AssetManager", "bool removeAssetGroup(AssetGroup @+)",
                                     asMETHODPR(AssetManager, removeAssetGroup, (AssetGroup*), bool),
                                     asCALL_THISCALL); assert(r >= 0);
    r = engine->RegisterObjectMethod("AssetManager", "bool removeAssetGroup(const u32)",
                                     asMETHODPR(AssetManager, removeAssetGroup, (const u32), bool),
                                     asCALL_THISCALL); assert(r >= 0);
    r = engine->RegisterObjectMethod("AssetManager", "bool removeAssetGroup(const string &in)",
                                     asMETHODPR(AssetManager, removeAssetGroup, (const std::string&), bool),
                                     asCALL_THISCALL); assert(r >= 0);
}

#endif // __COMPILE_WITH_ANGELSCRIPT__

// End of File
